import { Column, Entity, PrimaryGeneratedColumn} from 'typeorm';

@Entity()
export class Archive {

    @PrimaryGeneratedColumn({
        type: 'int',
        name: 'id',
        })
    id: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'user_id',
        })
    userId: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'channel_id',
        })
    channelId: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'model_id',
        })
    modelId: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'special_id',
        })
    specialId: number;

    @Column('varchar', {
        nullable: false,
        length: 80,
        name: 'title',
        })
    title: string;

    @Column('varchar', {
        nullable: true,
        length: 100,
        name: 'style',
        })
    style: string ;

    @Column('enum', {
        nullable: false,
        name: 'flag',
        enum: ['normal', 'hidden', 'rejected', 'pulloff'],
        default: 'normal',
        })
    flag: string;

    @Column('varchar', {
        nullable: false,
        name: 'image',
        })
    image: string;

    @Column('varchar', {
        nullable: false,
        name: 'keywords',
        })
    keywords: string;

    @Column('varchar', {
        nullable: false,
        name: 'description',
        })
    description: string;

    @Column('varchar', {
        nullable: false,
        name: 'tags',
        })
    tags: string;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'weigh',
        })
    weigh: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'views',
        })
    views: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'comments',
        })
    comments: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'likes',
        })
    likes: number;

    @Column('int', {
        nullable: false,
        default: () => '\'0\'',
        name: 'dislikes',
        })
    dislikes: number;

    @Column('varchar', {
        nullable: false,
        length: 50,
        name: 'diyname',
        })
    diyname: string;

    @Column('timestamp', {
      nullable: false,
      default: () => 'CURRENT_TIMESTAMP',
      name: 'created_at',
    })
    createdAt: Date;

    @Column('timestamp', {
      nullable: false,
      default: () => 'CURRENT_TIMESTAMP',
      name: 'updated_at',
    })
    updatedAt: Date;

    @Column('timestamp', {
      nullable: true,
      name: 'deleted_at',
    })
    deletedAt: Date;

    @Column('int', {
        nullable: true,
        name: 'publish_at',
        })
    publishAt: number | null;

    @Column('varchar', {
        nullable: true,
        length: 100,
        name: 'memo',
        })
    memo: string | null;

    @Column('enum', {
        nullable: false,
        default: 'normal',
        enum: ['normal', 'hidden', 'rejected', 'pulloff'],
        name: 'status',
        })
    status: string;

}
